#include <stdio.h>
#include <gmp.h>
#include <assert.h>

int main(int argc, char **argv) {
  mpz_t sum;

  mpz_init(sum);
  mpz_set_ui(sum, 0UL);

  for (;;) {
    unsigned long p;
    if (feof(stdin))
      break;

    size_t ret = fscanf(stdin, "%lu\n", &p);

    assert(ret > 0);

    if (p >= 2000000UL)
      break;

    mpz_add_ui(sum, sum, p);
  }

  printf("sum of primes below 2000000 is: ");
  mpz_out_str(stdout, 10, sum);
  printf("\n");

  return 0;
}
